<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>若梦TV，全网品质好单采集平台</title>
	<meta name="keywords" content="若梦、若梦TV、若梦金冠联盟、采集站、淘客、淘宝客、淘客工具、淘客软件、淘客联盟
">
	<meta name="description" content="若梦TV采集站ruomengtv.com，是若梦金冠联盟优质好单采集平台；专注优质商品，严格把控品质，超高转化，提高收益，为淘客提供最好的商品精选采集平台！">
	<link rel="icon" href="favicon.ico">
	<link rel="stylesheet" type="text/css" href="../../lib/css/animate.min.css">
	<link rel="stylesheet" type="text/css" href="../../layui/css/layer.min.css">
	<link rel="stylesheet" type="text/css" href="../../lib/css/jquery.page.min.css">
	<link rel="stylesheet" type="text/css" href="../../lib/css/fakeloader.css">
	<link rel="stylesheet" type="text/css" href="../../lib/css/reset.css">
	<link rel="stylesheet" type="text/css" href="../../css/comm.css">
	<link rel="stylesheet" type="text/css" href="../../css/data_main.css">
	<link rel="stylesheet" type="text/css" href="../../css/style.css">
	<link rel="stylesheet" type="text/css" href="../../iconfont/iconfont.css">

</head>
<body>
	<!-- 头部 -->
	<header class="header">
		<div class="head">
			<div class="head-left left">
				<a href="index.html" title="若梦TV--首页"><img src="../../img/logo.png" alt=""></a>
				<div class="experience">
					<div class="left">体验</div>
					<div class="right"><a href="http://tool.ruomengtv.com" title="天天赚发单助手" target="_blank">天天赚发单助手</a></div>
				</div>
			</div>
			<!--搜索-->
			<div class="left search-wrap active">
				<div class="left">
					<input type="text" placeholder="输入关键词或商品链接">
					<!--搜索历史-->
					<div class="searchHistory">
						<!-- <div class="historyItem">1</div>
						<div class="historyItem">2</div>
						<div class="historyItem">什么事没事没事</div>
						<div class="historyItem">耐克</div>
						<div class="historyItem">鞋子啊</div> -->
					</div>
					<!--搜索历史结束-->
				</div>
				<div class="right">搜索</div>
			</div>
			<!--搜索结束-->
			<div class="head-right right">
				<div class="left login btn" onclick="location.href='../login/login.html';">登录</div>
				<div class="right register btn" onclick="location.href='../login/regsiter.html';">注册</div>
			</div>
			<!--登录后显示区域-->
			<div class="head-right2 right hide">
				<img class="left releaseIcon" src="../../img/head_icon1.png" title="发布" alt="">
				<img class="left informIcon" src="../../img/head_icon2.png" title="未读消息" alt="">
				<div class="left informNum" title="未读消息">0</div>
				<div class="left headOuter" title="个人中心">
					<img class="headPic" src="../../img/default_head.png" alt="">
				</div>
			</div>
			<!--登录后显示区域结束-->
		</div>
	</header>

	<!--主体内容-->
	<div class="wrap">
		<div class="personalMsg">
			<div class="left leftArea">
				<div class="pointOuter">
					<img src="../../img/point.png" alt="">
					<span class="point">100积分</span>
				</div>
				<div class="btn" onclick="popShow('.pidPop');">填写我的PID</div>
				<div class="btn" onclick="popShow('.referralCodePop');">设置推荐码</div>
				<div class="btn">推广APP</div>
			</div>
			<div class="left middleArea">
				<div class="headOuter">
					<img class="icon" src="../../img/default_head.png" alt="">
				</div>
				<div class="nickName"><!-- 用户昵称 --></div>
				<div class="sign"><!-- 这是一个个性签名哈哈哈哈哈 --></div>
			</div>
			<div class="right rightArea">
				<div class="nums">
					<div class="left submit active">
						<div class="num submitNum">0</div>
						<div class="text submitText">提交</div>
					</div>
					<div class="left passed">
						<div class="num passedNum">0</div>
						<div class="text passedText">通过</div>
					</div>
					<div class="right check">
						<div class="num checkNum">0</div>
						<div class="text checkText">审核中</div>
					</div>
				</div>
				<div class="btn modifyBtn" onclick="popShow('.modifiMsgPop');">修改资料</div>
				<div class="btn modifyPhoneBtn" onclick="popShow('.modifiPhonePop');">更改手机号</div>
				<div class="btn signOutBtn">退出</div>
			</div>
		</div>
		<!--时间选择区域-->
		<div class="timeSelectArea">
			<div class="btn back" title="前一天" ><i class="iconfont">&#xe602;</i></div>
			<div class="layui-inline">
				<input class="layui-input" placeholder="请选择提交日期" >
			</div>
			<div class="btn forward" title="后一天" ><i class="iconfont">&#xe601;</i></div>
		</div>
		<!--时间选择区域结束-->
		<!--状态类别栏-->
		<div class="statusSorts">
			<span class="btn btn1 passed active" data-status=2>通过<span class="passedNum">（0）</span></span>
			<span class="btn btn1 check" data-status=1>审核中<span class="checkNum">（0）</span></span>
			<span class="btn btn1 repulse" data-status=3>打回<span class="repulseNum">（0）</span></span>
			<div class="btn submitNewBtn" >提交新单</div>
		</div>
		<!--状态类别栏结束-->

		<!--商品展示区域-->
		<div class="goods-wrap">
			<!--<div class="item">
				<div class="item-img-wrap">
					<div class="item-logo">
						TOP <br />
						1
					</div>
					<div class="item-img">
						<a href=" " title=" + e.goodsName + " target="_blank"><img class="scrollLoading" src=https://img.alicdn.com/imgextra/i4/1072286858/TB2xuvQt3NlpuFjy0FfXXX3CpXa_!!1072286858.png data-original=" + e.img + "></a>
					</div>
					<div class="copy-btn" >
						复制文案
					</div>
				</div>
				<h1> <a href="" title=" + e.goodsName + " target="_blank"> goodsName</a></h1>
				<div class="coupon">
					<div class="left">
						<h2>￥<span style="color:#03a9f4">100</span></h2>
						<h3>券后价</h3>
					</div>
					<div class="left">
						<h2>￥<span>20</span></h2>
						<h3>优惠券</h3>
					</div>
					<div class="left last">
						<h2>80.00 <span>%</span></h2>
						<h3>定向</h3>
					</div>
					<div class="clearfix"></div>
				</div>
				<div class="coupon-btn btn">
					<a href="  " target="_blank"> 哈哈哈 </a>
				</div>
				<h4> 2017-01-02 11:20 &nbsp;&nbsp;&nbsp;发布</h4>
				<div class="item-more">
					<div class="left">
						销量<span> 111111</span>
					</div>
					<div class="right">
						goodsType
						<img src="" alt="">
					</div>
					<div class="clearfix"></div>
				</div>
			</div>-->
		</div>
		<!--商品展示区域结束-->
		<!-- 分页 -->
		<div class="page-wrap" style="display: none;">
			<div id="page"></div>
		</div>
		<!--分页结束-->
	</div>

	<!-- 加载层 -->
	<div class="fakeloader"></div>
	<!-- 复制文案 -->
	<div class="copy-data"></div>
	<!-- 返回顶部 -->
	<div class="scrollTop">
		<div class="scrollTop-top"></div>
		<div class="scrollTop-bottom">返回顶部</div>
	</div>
	
	<!--我的选品-->
	<div class="mySelection">
		<div class="left leftArea">
			<div class="btn shrinkBtn"><i class="iconfont">&#xe64e;</i>我的选品 <span class="selectionNum">0</span></div>
		</div>
		<div class="right rightArea">
			<div class="itemOuter">
			</div>
			<div class="deleteBtn">删除</div>
		</div>
	</div>
	<!--我的选品结束-->

	<!--遮罩层-->
	<div class="grey hide" onclick="popHide();"></div>
	<!--遮罩层结束-->

	<!--填写我的PID弹窗-->
	<div class="popUp pidPop hide">
		<div class="titleArea gradient">
			<div class="spaceBox"><!--为防止垂直间距合并--></div>
			<div class="title">填写我的PID</div>
		</div>
		<div class="contentArea">
			<div class="outer pidOuter">
				<label for="pid">pid</label>
				<input id="pid" type="text" maxlength="28" placeholder="请填写我的PID" />
				<a class="help unit" href="">配置流程帮助</a>
			</div>
			<div class="desc">
				说明：<br>
				联盟备案获取APP推广位PID→配置推荐码→开通高佣API授权 <br>
				推荐用户安装APP，用户购买商品时会打开你填写的pid链接，佣金结算到你填写的pid账户内，请确认填写正确的pid
			</div>
		</div>
		<div class="btnArea">
			<div class="btn gradient" onclick="submitPid()">确定</div>
		</div>
	</div>
	<!--填写我的PID弹窗结束-->

	<!--设置推荐码弹窗-->
	<div class="popUp referralCodePop hide">
		<div class="titleArea gradient">
			<div class="spaceBox"><!--为防止垂直间距合并--></div>
			<div class="title">设置推荐码</div>
		</div>
		<div class="contentArea">
			<div class="outer codeOuter">
				<label for="code">推荐码</label>
				<input id="code" type="text" minlength="6" maxlength="16" placeholder="请填写推荐码">
				<span class="unit tip">6~16位数字或者字母</span>
			</div>
			<div class="desc">
				说明：<br>
				用户安装APP后，注册时需要填写你的推荐码，填写你的推荐码后，用户在购买时就会打开带有你的pid的链接，购买成功后佣金结果会发送到你的pid账户内
			</div>
		</div>
		<div class="btnArea">
			<div class="btn gradient" onclick="setCode();">确定</div>
		</div>
	</div>
	<!--设置推荐码弹窗结束-->

	<!--修改资料弹窗-->
	<div class="popUp modifiMsgPop hide">
		<div class="titleArea gradient">
			<div class="spaceBox"><!--为防止垂直间距合并--></div>
			<div class="title">修改资料</div>
		</div>
		<div class="contentArea">
			<div class="outer headOuter">
				<label>头像</label>
				<div class="uploadOuter">
					<img id="p_icon" src="../../img/head_upload.png" alt="">
					<input type="file" class="addimgIpt" name="file" accept="image/gif,image/jpeg,image/png"/>
				</div>
			</div>
			<div class="outer">
				<label for="nickname">昵称</label>
				<input id="nickname" type="text" maxlength=10 placeholder="请填写昵称">
			</div>
			<div class="outer">
				<label for="sign">个性签名</label>
				<textarea name="" id="sign" maxlength=32 placeholder="请填写个性签名"></textarea>
			</div>
			<div class="outer">
				<label for="phone">手机号</label>
				<input id="phone" type="tel" placeholder="请填写手机号">
			</div>
		</div>
		<div class="btnArea">
			<div class="btn gradient">确定</div>
		</div>
	</div>
	<!--修改资料弹窗结束-->

<!--修改手机号弹窗-->
	<div class="popUp modifiPhonePop hide">
		<div class="titleArea gradient">
			<div class="spaceBox"><!--为防止垂直间距合并--></div>
			<div class="title">修改手机号</div>
		</div>
		<div class="contentArea">
			<div class="outer">
				<span class="oldPhoneOuter">已绑定手机号：</span> <span class="oldPhone"><!-- 1356433290 --></span>
			</div>
			<div class="outer">
				<label for="newPhone">新手机号</label>
				<input id="newPhone" type="tel" placeholder="新手机号">
			</div>
			<div class="outer">
				<label for="imgCode">图片验证码</label>
				<input id="imgCode" type="text" maxlength=4 placeholder="图片验证码">
				<div class="imgVerifiCode"><img src="/user/checkCode" alt=""></div>
			</div>
			<div class="outer">
				<label for="authCode">验证码</label>
				<input id="authCode" type="text" maxlength=6 placeholder="短信验证码">
				<div class="send-code">获取验证码</div>
			</div>
		</div>
		<div class="btnArea">
			<div class="btn gradient">确定</div>
		</div>
	</div>
	<!--修改手机号弹窗结束-->

	<!--提交新单弹窗-->
	<div class="popUp submitNewPop hide">
		<div class="titleArea gradient">
			<div class="spaceBox"><!--为防止垂直间距合并--></div>
			<div class="title">提交新单</div>
		</div>
		<div class="contentArea">
			<div class="outer headOuter">
				<label>商品图</label>
				<div class="uploadOuter">
					<img id="goodsIcon" src="../../img/head_upload.png" alt="">
					<input id="uploadGoods" type="file" class="addimgIpt" name="file" accept="image/gif,image/jpeg,image/png"/>
				</div>
				<span class="tips">尺寸大小为400*400像素</span>
			</div>
			<div class="outer headOuter">
				<label>文案图</label>
				<div class="uploadOuter">
					<img id="wenanIcon" src="../../img/head_upload.png" alt="">
					<input id="uploadWenan" type="file" class="addimgIpt" name="file" accept="image/gif,image/jpeg,image/png"/>
				</div>
				<span class="tips">尺寸大小为800*1200像素</span>
			</div>
			<div class="outer">
				<label for="title">商品标题</label>
				<input id="title" type="text" placeholder="请填写商品标题">
			</div>
			<div class="outer">
				<label for="originalPrice">原价</label>
				<input id="originalPrice" type="number" placeholder="请填写原价">
				<span class="unit">元</span>
			</div>
			<div class="outer">
				<label for="presenPrice">券后价</label>
				<input id="presenPrice" type="number" placeholder="请填写券后价">
				<span class="unit">元</span>
			</div>
			<div class="outer">
				<label for="couponUrl">优惠券</label>
				<textarea name="" id="couponUrl" placeholder="请填写优惠券链接"></textarea>
			</div>
			<div class="outer">
				<label for="productUrl">商品链接</label>
				<input id="productUrl" type="text" placeholder="请填写商品链接">
			</div>
			<div class="outer">
				<label for="copywriting">文案</label>
				<textarea name="" id="copywriting" placeholder="请填写文案"></textarea>
			</div>
			<div class="outer">
				<label for="brokerage">佣金</label>
				<input id="brokerage" type="number" placeholder="请填写佣金">
				<span class="unit">%</span>
			</div>
			<div class="outer brokerageType">
				<label>佣金类型</label>
				<div class="sorts">
					<div class="btn sort active" data-sort="1">通用</div>
					<div class="btn sort" data-sort="2">定向</div>
					<div class="btn sort" data-sort="3">鹊桥</div>
					<div class="btn sort" data-sort="4">营销</div>
				</div>
			</div>
			<div class="outer activeSync">
				<label>活动同步</label>
				<div class="sorts syncSort">
					<div class="btn sort active" data-sort="1">是</div>
					<div class="btn sort" data-sort="0">否</div>
				</div>
			</div>
			<div class="outer activeTypeOuter">
				<label>活动类型</label>
				<div class="sorts">
					<div class="btn sort active" data-sort="1">聚划算</div>
					<div class="btn sort" data-sort="2">淘抢购</div>
				</div>
			</div>
		</div>
		<div class="btnArea">
			<div class="btn gradient">确定</div>
		</div>
	</div>
	<!--提交新单弹窗结束-->

</body>

<script type="text/javascript" charset="UTF-8" src="../../lib/js/jquery.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../lib/js/jquery.page.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../lib/js/clipboard.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../layui/lay/dest/layui.all.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../layui/layer.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../lib/js/fakeloader.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../lib/js/jquery.lazyload.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../js/main.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../lib/js/jquery.hDialog.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../js/data_main.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../js/send_code.js"></script>
<script>
var usercode = getStorage( "usercode" );

$( function()
{
	//加載用戶信息
	getUserMsg( 1 );
	
	//加载三个状态单子数量
	getThreeNum2(usercode,"");

	//默认加载所有通过单子

	get_my_goods(1,2,"");//examine_status - 0：新提交 1：审核中 2：通过 3：打回 4：全部



	//切换小分类
	$( ".statusSorts .btn1" ).click( function()
	{
		$( ".statusSorts .btn" ).removeClass( "active" );
		$( this ).addClass( "active" );
		var dataStatus = $( ".statusSorts .btn.active" ).attr( "data-status" );
		var searchDate = $( ".layui-input" ).val();
		get_my_goods( 1,dataStatus, searchDate );
	} );

	//根据时间查询-直接选择
	document.getElementsByClassName( 'layui-input' )[ 0 ].onclick = function()
	{
		layui.laydate( {
			elem: this,
			format: 'YYYY-MM-DD',
			choose: function( dates )
			{ //选择好日期的回调
				var dataStatus = $( ".statusSorts .btn.active" ).attr( "data-status" );
				getThreeNum2(usercode,dates);
				get_my_goods( 1,dataStatus, dates );
			}
		} );
	};
	//清空日期
	$(document).on("click","#laydate_clear",function(){
		var dataStatus = $( ".statusSorts .btn.active" ).attr( "data-status" );
		getThreeNum2(usercode,"");
		get_my_goods( 1,dataStatus, "" );
	})
	
	
	//根据时间查询-前一天
	$( ".timeSelectArea .back" ).click( function()
	{
		var layuiInput = $( ".layui-input" ).val();
		if(layuiInput==""){
			$.tooltip( "请先选择一个日期" );
			return false;
		}
		var newDate = previousDay();
		var dataStatus = $( ".statusSorts .btn.active" ).attr( "data-status" );
		getThreeNum2(usercode,newDate);
		get_my_goods(1, dataStatus, newDate );
	} );
	//根据时间查询-后一天
	$( ".timeSelectArea .forward" ).click( function()
	{
		var layuiInput = $( ".layui-input" ).val();
		if(layuiInput==""){
			$.tooltip( "请先选择一个日期" );
			return false;
		}
		var newDate = nextDay();
		var dataStatus = $( ".statusSorts .btn.active" ).attr( "data-status" );
		getThreeNum2(usercode,newDate);
		get_my_goods( 1,dataStatus, newDate );
	} );

} );

//淘客个人中心加载单子
function get_my_goods( page,examine_status,createTime )
{
	var dataJson = {
		"pageIndex":page,
		"usercode": usercode,
		"examine_status": examine_status,//单子状态
		"createTime": createTime//单子提交日期
	};
	$.ajax( {
		type: "POST",
		url: ajaxUrl + "/p-info/getGoodsList",
		data: dataJson,
		success: function( data )
		{
			console.log( JSON.stringify( data ) );
			if( data.code == 0 )
			{
				var count = data.data.counts;
				if(examine_status==1){
					$(".statusSorts .checkNum").text("（"+count+"）");
				}else if(examine_status==2){
					$(".statusSorts .passedNum").text("（"+count+"）");
				}else{
					$(".statusSorts .repulseNum").text("（"+count+"）");
				}
				var lists = data.data.list;
				if(lists.length!=0){
					var result="";
					$.each( lists, function( i, list )
					{
						var commissionProportion = list.commissionProportion;//佣金比例
						var commissionType = getCommissionType(list.commissionType);//佣金类型
						var count = list.count;//优惠券
						var voucherPrice = list.voucherPrice;//券后价
						var submitTime = format( parseInt(list.createTime), "yyyy-MM-dd HH:mm" );//提交时间
						var goodsName = list.goodsName;
						var img = list.img;//商品图
						var img2 = list.img2;//文案图
						var message = list.message;//文案
						var itemId = list.itemId;//商品id
						var sfm = list.sfm;
						var shopType = list.shopType;
						var imgUrl,goodsHref;
						if( shopType == 2 )
						{  //   天猫
							imgUrl = '../../img/tianmao.png';
							goodsHref = "https://detail.tmall.com/item.htm?id=" + itemId;
						}
						else
						{  // 淘宝
							imgUrl = '../../img/taobao.png';
							goodsHref = "https://item.taobao.com/item.htm?id=" + itemId;
						}

						var goodType = list.goodType;//活动类型
						var goodsType="";
						if( goodType == 1 ){//聚划算
							goodsType = '<img src="../../img/jhs.png" alt="">';
						}else if(goodType == 2){
							// 淘抢购
							goodsType = '<img src="../../img/tqg.png" alt="">';
						}
						result+='<div class="item item1"> ' +
										'<div class="item-img-wrap"> ' +
										'<div class="item-img"> ' +
										'<a href=" '+goodsHref+'" title=' + goodsName + ' target="_blank"><img class="scrollLoading" src='+img+' data-original="' + img + '"></a> ' +
										'</div> ' +
										'<div class="copy-btn" copy-data=\'<img src="' + img2 + '" >' + message + '\' data-clipboard-target=".copy-data">复制文案 </div> ' +
										'</div> ' +
										'<h1> <a href="'+goodsHref+'" title=' + goodsName + ' target="_blank">'+goodsName+'</a></h1> ' +
										'<div class="coupon"> ' +
										'<div class="left"> ' +
										'<h2>￥<span style="color:#03a9f4">'+voucherPrice+'</span></h2> ' +
										'<h3>券后价</h3> ' +
										'</div> ' +
										'<div class="left"> ' +
										'<h2>￥<span>'+count+'</span></h2> ' +
										'<h3>优惠券</h3> ' +
										'</div> ' +
										'<div class="left last"> ' +
										'<h2>'+commissionProportion+' <span>%</span></h2> ' +
										'<h3>'+commissionType+'</h3> ' +
										'</div> ' +
										'<div class="clearfix"></div> ' +
										'</div> ' +
										
										'<h4 style="margin-top:15px;margin-bottom:12px;"> '+submitTime+' &nbsp;&nbsp;&nbsp;提交</h4> ' +
										'<div class="item-more"> ' +
										'<div class="right">'+goodsType+'<img src="'+imgUrl+'" alt=""></div> ' +
										'<div class="clearfix"></div> ' +
										'</div> ' +
										'</div>';
					} );
					result += '<div class="clearfix"></div>';
					$( ".goods-wrap" ).html( result );
					imgLazyLoad();
					copy_int();//复制文案
					//分页
					$(".page-wrap").show();//显示分页
					$( "#page" ).Page( {
						totalPages: data.data.pageCount,//分页总数
						liNums: 7,//分页的数字按钮数(建议取奇数)
						current: page, //当前页
						activeClass: 'activP', //active 类样式定义
						callBack: function( page )
						{
							$( 'body,html' ).animate( { scrollTop: '400px' }, 500 );
							page++;
							get_my_goods( page,examine_status,createTime );
						}
					} );
				}else{
					var s = '<div class="no-data">' +
									'<img src="../../img/no_data.png" alt="">' +
									'什么都没找到,怪我咯~' +
									'<div>';
					$( '.goods-wrap' ).html( s );
					$(".page-wrap").hide();//隐藏分页
				}

			}
			else
			{
				$.tooltip( data.message );
			}
		},
		error: function( data )
		{
			$.dialog( 'alert', '错误', '服务器走丢了', 1500 );
		}
	} );
}
/* //pid输入补全控制
$( "#pid" ).bind('input propertychange', function() {
	var pid = $(this).val();
	console.log(pid.length);
	if(pid.length==11 || pid.length==19){
		pid+="_";
		$(this).val(pid);
	}
	var num1 = pid.substring(3,10);
	var num2 = pid.substring(12,18);
	var num3 = pid.substring(20,27);
	console.log("1:"+num1,"2:"+num2,"3:"+num3);
	var isNumber= new RegExp(/^[\d]+$/);
	if( (num1!="" && !isNumber.test(num1)) || (num2!="" && !isNumber.test(num2)) || (num3!="" && !isNumber.test(num3))){
		$.tooltip( "请不要输入非数字字符" );
	}
}); */

//提交pid
function submitPid()
{
	var data = JSON.parse( getStorage( "userMsg" ) );
	var usercode = data.usercode;
	var pid = $( "#pid" ).val();
	var mm = pid.substring(0,2);//mm_
	var line1 = pid.substring(12);
	var line2 = pid.substring(20);
	var num1 = pid.substring(3,10);
	var num2 = pid.substring(12,18);
	var num3 = pid.substring(20,27);
	var isNumber= new RegExp(/^[\d]+$/);
	if( pid == "" || pid.replace( /\s/g, "" ) == "" )
	{//判断是否输入
		$.tooltip( '请输入pid' );
		return;
	}
	if( (mm!="mm_") || (line1!="_") || (line2!="_") || (num1!="" && !isNumber.test(num1)) || (num2!="" && !isNumber.test(num2)) || (num3!="" && !isNumber.test(num3)) )
	{//判断格式是否正确
		$.tooltip( '请填写正确格式的pid，例：mm_12345678_1234567_12345678' );
		return;
	}
	var parameter = {
		usercode: usercode,
		pid: pid
	};
	$.ajax( {
		url: ajaxUrl + '/p-info/submitPid',
		type: 'post',
		data: parameter,
		beforeSend: function()
		{
			loading( "rgba(0,0,0,0.66)", "spinner1" );
		},
		complete: function()
		{
			loading_success();
		},
		success: function( a )
		{
			if( a.code == 0 )
			{
				popHide();

				layer.msg( "提交成功" )
			}
			else
			{
				$.tooltip( a.message );
			}
		},
		error: function()
		{
			$.dialog( 'alert', '错误', '服务器走丢了', 1500 );
		}
	} )
}

//设置推荐码
function setCode()
{
	var code = $( "#code" ).val();
	if( code == "" || code.replace( /\s/g, "" ) == "" )
	{
		$.tooltip( '推荐码不能为空' );
		return;
	}
	if(code.length<6 || code.length>16){
		$.tooltip( '请输入6-16位的推荐码' );
		return;
	}
	var reg = /^[0-9a-zA-Z]+$/;
	if(!reg.test(code)){
		$.tooltip( '推荐码只能由数字和字母组成' );
		return;
	}
	var dataJson = { "refcode": code, "usercode": usercode };
	$.ajax( {
		type: 'post',
		url: ajaxUrl + '/p-info/updateRefcode',
		data: dataJson,
		beforeSend: function()
		{
			loading( "rgba(0,0,0,0.66)", "spinner1" );
		},
		complete: function()
		{
			loading_success();
		},
		success: function( a )
		{

			if( a.code == 0 )
			{
				popHide();
				layer.msg( "提交成功" );
			}
			else
			{
				$.tooltip( a.message );
			}
		},
		error: function()
		{
			$.dialog( 'alert', '错误', '服务器走丢了', 1500 );
		}
	} )
}

</script>
</html>